<template>
	<view class="detail-content">
	
		<view style="display: flex;justify-content: center;">
			<image style="width: 400rpx;" :src="src" mode="aspectFit" class="detail-img"></image>
		</view>
		
		
		<view class="detail-name">
				{{item.name}}
		</view>
		<view class="detail-text">
				{{item.detail}}
		</view>
		
		<view style="padding: 60rpx;">
			<button type="primary" @click="goBack" style="background: #108EE9;">返回</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item:{},
				src:''
			}
		},
		onLoad(option) {
			this.item = uni.getStorageSync('voteItemDetail')
			console.log(this.item)
			if(this.item.cover != ''){
				this.downLoadFile(this.item.cover)
			}else{
				this.src = '../../static/images/default.png'
			}
			// uni.removeStorageSync('voteItemDetail')
		},
		mounted() {
			
		},
		methods: {
			goBack(){
				uni.navigateBack({
					
				})
			},
			downLoadFile(id,index) {
				this.$http.post('common/file/download', {
					id: id
				}).then(res => {				
					if (res.code == 10000) {
						console.log(res.data)
						this.src = res.data.fileData
						console.log(this.src)
						// this.coverList.splice(index,1, res.data.fileData)
						// console.log(this.coverList)
					}else{
						
					}
				})
			},
			
		}
	}
</script>

<style scoped>
	.detail-content{
		padding: 10rpx;
		text-align: center;
	}
.detail-img{
	margin: 20rpx;
}
.detail-name{
	margin-bottom: 30rpx;
}
.detail-text{
	text-align: left;
	padding: 0 50rpx;
	text-indent: 2em;
	line-height: 1.5;
	color: #797979;
}
</style>
